# Contributor: Andy Li <andy@onthewings.net>
# Maintainer: Andy Li <andy@onthewings.net>
pkgname=ocaml-ptmap
_pkgname=ptmap
pkgver=2.0.4
pkgrel=0
pkgdesc="Maps over integers implemented as Patricia trees"
url="https://github.com/backtracking/ptmap"
arch="all !x86 !armhf !armv7 !s390x !mips !mips64"  # limited by ocaml aport
license="LGPL-2.1-or-later WITH OCaml-linking-exception"
depends="ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="ocaml ocaml-findlib ocaml-obuild ocaml-qtest ocaml-qcheck-dev ocaml-ounit-dev"
subpackages="$pkgname-dev"
options="!check"  # no tests provided
source="$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	obuild configure
	obuild build
	obuild build lib-ptmap
}

package() {
	obuild install --destdir "$pkgdir/usr/lib/ocaml"

	# Remove annotation files and sources.
	rm \
		"$pkgdir"/usr/lib/ocaml/ptmap/*.cmt \
		"$pkgdir"/usr/lib/ocaml/ptmap/*.cmti
}

dev() {
	default_dev

	mkdir -p "$subpkgdir"/usr/lib/ocaml/ptmap
	mv \
		"$pkgdir"/usr/lib/ocaml/ptmap/*.cmx \
		"$pkgdir"/usr/lib/ocaml/ptmap/*.cmxa \
		"$subpkgdir"/usr/lib/ocaml/ptmap/
}

sha512sums="3f11664f926244a212e2d782d338982826e608463eec22e91cd77350836cbab9d4aed7542fa9c5f3c1df572552a3797a149618ad370d1b47b4e03cf497100356  ocaml-ptmap-2.0.4.tar.gz"
